<template direction="vertical">
  <img src="/logo.png" class="img" alt=""/>
  <span style="font-family: 方正舒体; font-size: 30px" class="font"
  >欢迎来心理咨询平台，现在就开始吧^_^</span
  >
  <a-button
      class="newApplyStyle"
      :disabled="buttonStatus2"
      style="background-color: unset;"
      @click="newApply"
  >新建申请
  </a-button
  >
  <img src="/orderMan.png" class="manImg"/>

  <a-modal v-model:visible="spaceVisible" title="详细情况" @ok="">
    <a-space direction="vertical">
      <a-divider/>
      请填写以下这个问卷让我们了解一下情况吧
      <a-divider/>
      <div>
        1,
        <div>
          <a-radio-group
              v-model:value="value1"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1">我不感到悲伤</a-radio>
              <a-radio :style="radioStyle" :value="2">我经常感到悲伤</a-radio>
              <a-radio :style="radioStyle" :value="3">我一直感到悲伤</a-radio>
              <a-radio :style="radioStyle" :value="4"
              >我太悲伤或太难过，到了难以忍受程度
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        2,
        <div>
          <a-radio-group
              v-model:value="value2"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我没有对未来失去信心
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >我比以往更加对未来没有信心
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3">我感到前景黯淡</a-radio>
              <a-radio :style="radioStyle" :value="4"
              >我觉得将来毫无希望，并且只会变得更加糟糕
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        3,
        <div>
          <a-radio-group
              v-model:value="value3"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我不觉得自己是个失败者
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2">我的失败比较多</a-radio>
              <a-radio :style="radioStyle" :value="3"
              >回首往事，我看到一大堆的失败
              </a-radio
              >
              <a-radio :style="radioStyle" :value="4"
              >我觉得自己是一个彻底的失败者
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        4,
        <div>
          <a-radio-group
              v-model:value="value4"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我没有任何自杀的想法
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >我有自杀的想法，但我不会去做
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3">我想自杀</a-radio>
              <a-radio :style="radioStyle" :value="4"
              >如果有机会我就会自杀
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        5,
        <div>
          <a-radio-group
              v-model:value="value5"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >和过去比较，我最近哭或想要哭的次数没有增加多少
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >和过去比较，我最近比过去哭或想要哭的次数增加了一些
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3"
              >和过去比较，最近任何小事都会让我哭或想要哭
              </a-radio
              >
              <a-radio :style="radioStyle" :value="4"
              >和过去比较，最近我一直特别想要哭，但却又哭不出来
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        6,
        <div>
          <a-radio-group
              v-model:value="value6"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我现在没有比过去更加烦躁
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >我现在比过去更容易烦躁
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3"
              >我最近非常烦躁或不安，很难保持安静
              </a-radio
              >
              <a-radio :style="radioStyle" :value="4"
              >我非常烟躁不安，必须不停走动或做事情
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        7,
        <div>
          <a-radio-group
              v-model:value="value7"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我对其他人或活动没有失去兴趣
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >和过去相比，我对其他人或事的兴趣减少了
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3"
              >我失去了对其他人或事的大部分兴趣
              </a-radio
              >
              <a-radio :style="radioStyle" :value="4"
              >现在任何事情都很难引起我的兴趣
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        8,
        <div>
          <a-radio-group
              v-model:value="value8"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我不觉得自己没有价值
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >我认为自己不如过去有价值或有用了
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3"
              >我觉得自己不如别人有价值
              </a-radio
              >
              <a-radio :style="radioStyle" :value="4"
              >我觉得自己不如别人有价值 我觉得自己毫无价值
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        9,
        <div>
          <a-radio-group
              v-model:value="value9"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我没觉得比过去累或乏力
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >我比过去更容易累或乏力
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3"
              >因为太累或者太乏力，很多过去常做的事情不能做了
              </a-radio
              >
              <a-radio :style="radioStyle" :value="4"
              >因为太累或者太乏力，几乎全部过去常做的事情都不能做了
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        10,
        <div>
          <a-radio-group
              v-model:value="value10"
              direction="vertical"
              showArrow="false"
          >
            <a-space direction="vertical">
              <a-radio :style="radioStyle" :value="1"
              >我没觉得自己在受惩罚
              </a-radio
              >
              <a-radio :style="radioStyle" :value="2"
              >觉得自己可能会受到惩罚(可能会但是未发生)
              </a-radio
              >
              <a-radio :style="radioStyle" :value="3"
              >我觉得自己会受到惩罚(确定会但是未发生)
              </a-radio
              >
              <a-radio :style="radioStyle" :value="4"
              >我觉得正在受到惩罚(已经发生)
              </a-radio
              >
            </a-space>
          </a-radio-group>
        </div>
      </div>
      <a-divider/>
      <div>
        11,有什么想说一说的吗？
        <a-textarea v-model:value="description"/>
      </div>
      <a-divider/>
      <div>
        12,选一个时间聊聊吧
        <a-date-picker v-model:value="expect_time"/>
      </div>
      <a-divider/>
      <a-space direction="horizental" style="width: 100" :size="2">
        <a-button
            :disabled="buttonStatus2"
            style="margin-left: 3px"
            @click="submitt"
        >提交
        </a-button
        >
        <a-button
            :disabled="buttonStatus2"
            style="margin-left: 3px"
            @click="cancle"
        >取消
        </a-button
        >
      </a-space>
    </a-space>
  </a-modal>
</template>

<script setup>
////////////////////////////////////////////
import {reactive, ref} from "vue";
import {post, setLocalToken} from "@/common";
import {useRouter} from "vue-router";
import {get} from "@/common";
import {message} from "ant-design-vue";
// import { fa, tr } from "element-plus/es/locale";
//import {DownloadOutlined} from "";
////////////////////////////////////////////
////////////////////////////////////////////

////////////////////////////////////////////
const value1 = ref(1);
const value2 = ref(1);
const value3 = ref(1);
const value4 = ref(1);
const value5 = ref(1);
const value6 = ref(1);
const value7 = ref(1);
const value8 = ref(1);
const value9 = ref(1);
const value10 = ref(1);
const description = ref("");
const expect_time = ref("");
const spaceVisible = ref(false);
const answer1 = ref("");
const answer2 = ref("");
const answer3 = ref("");
const answer4 = ref("");
const answer5 = ref("");
const answer6 = ref("");
const answer7 = ref("");
const answer8 = ref("");
const answer9 = ref("");
const answer10 = ref("");
////////////////////////////////////////////

const activeKey = ref([]);
const radioStyle = reactive({
  display: "flex",
  height: "30px",
  lineHeight: "30px",
});

const newApply = () => {
  post("/student/firstVisit/checkIsInProgress", {}).then((res) => {
    if (res.code == 200) {
      spaceVisible.value = true;
      //router.push("/student/firstVisit/newApply");
    } else if (res.code == 2002) {
      message.info("咨询正在进行中,请先完成当前咨询。");
    } else {
      message.info("未知错误");
    }
  });
};
/*
 */
const submitt = () => {
  if (value1.value == 1) {
    answer1.value = "我不感到悲伤";
  } else if (value1.value == 2) {
    answer1.value = "我经常感到悲伤";
  } else if (value1.value == 3) {
    answer1.value = "我一直感到悲伤";
  } else {
    answer1.value = "我太悲伤或太难过，到了难以忍受程度";
  }

  if (value2.value == 1) {
    answer2.value = "我没有对未来失去信心";
  } else if (value2.value == 2) {
    answer2.value = "我比以往更加对未来没有信心";
  } else if (value2.value == 3) {
    answer2.value = "我感到前景黯淡";
  } else {
    answer2.value = "我觉得将来毫无希望，并且只会变得更加糟糕";
  }

  if (value3.value == 1) {
    answer3.value = "我不觉得自己是个失败者";
  } else if (value3.value == 2) {
    answer3.value = "我的失败比较多";
  } else if (value3.value == 3) {
    answer3.value = "回首往事，我看到一大堆的失败";
  } else {
    answer3.value = "我觉得自己是一个彻底的失败者";
  }

  if (value4.value == 1) {
    answer4.value = "我没有任何自杀的想法";
  } else if (value4.value == 2) {
    answer4.value = "我有自杀的想法，但我不会去做";
  } else if (value4.value == 3) {
    answer4.value = "我想自杀";
  } else {
    answer4.value = "如果有机会我就会自杀";
  }

  if (value5.value == 1) {
    answer5.value = "和过去比较，我最近哭或想要哭的次数没有增加多少";
  } else if (value5.value == 2) {
    answer5.value = "和过去比较，我最近比过去哭或想要哭的次数增加了一些";
  } else if (value5.value == 3) {
    answer5.value = "和过去比较，最近任何小事都会让我哭或想要哭";
  } else {
    answer5.value = "和过去比较，最近我一直特别想要哭，但却又哭不出来";
  }

  if (value6.value == 1) {
    answer6.value = "我现在没有比过去更加烦躁";
  } else if (value6.value == 2) {
    answer6.value = "我现在比过去更容易烦躁";
  } else if (value6.value == 3) {
    answer6.value = "我最近非常烦躁或不安，很难保持安静";
  } else {
    answer6.value = "我非常烟躁不安，必须不停走动或做事情";
  }

  if (value7.value == 1) {
    answer7.value = "我对其他人或活动没有失去兴趣";
  } else if (value7.value == 2) {
    answer7.value = "和过去相比，我对其他人或事的兴趣减少了";
  } else if (value7.value == 3) {
    answer7.value = "我失去了对其他人或事的大部分兴趣";
  } else {
    answer7.value = "现在任何事情都很难引起我的兴趣";
  }

  if (value8.value == 1) {
    answer8.value = "我不觉得自己没有价值";
  } else if (value8.value == 2) {
    answer8.value = "我认为自己不如过去有价值或有用了";
  } else if (value8.value == 3) {
    answer8.value = "我觉得自己不如别人有价值";
  } else {
    answer8.value = "我觉得自己不如别人有价值 我觉得自己毫无价值";
  }

  if (value9.value == 1) {
    answer9.value = "我没觉得比过去累或乏力";
  } else if (value9.value == 2) {
    answer9.value = "我比过去更容易累或乏力";
  } else if (value9.value == 3) {
    answer9.value = "因为太累或者太乏力，很多过去常做的事情不能做了";
  } else {
    answer9.value = "因为太累或者太乏力，几乎全部过去常做的事情都不能做了";
  }

  if (value10.value == 1) {
    answer10.value = "我没觉得自己在受惩罚";
  } else if (value10.value == 2) {
    answer10.value = "觉得自己可能会受到惩罚(可能会但是未发生)";
  } else if (value10.value == 3) {
    answer10.value = "我觉得自己会受到惩罚(确定会但是未发生)";
  } else {
    answer10.value = "我觉得正在受到惩罚(已经发生)";
  }

  description.value = "1> " + answer1.value + "\n" + "2> " + answer2.value + "\n" + "3> " + answer3.value + "\n" + "4> " + answer4.value + "\n" + "5> " + answer5.value + "\n" + "6> " + answer6.value + "\n" + "7> " + answer7.value + "\n" + "8> " + answer8.value + "\n" + "9> " + answer9.value + "\n" + "10> " + answer10.value + "\n" + "描述> " + description.value;


  post("/student/firstVisit/submit", {
    value1: value1.value,
    value2: value2.value,
    value3: value3.value,
    value4: value4.value,
    value5: value5.value,
    value6: value6.value,
    value7: value7.value,
    value8: value8.value,
    value9: value9.value,
    value10: value10.value,
    description: description.value,
    expect_time: expect_time.value.format("YYYY.MM.DD"),
  }).then((res) => {
    console.log(res);
    if (res.code == 200) {
      message.success("提交成功");
      spaceVisible.value = false;
    } else {
      message.error("提交失败");
    }
  });
};
const cancle = () => {
  spaceVisible.value = false;
};
</script>

<style>
.newApplyStyle {
  text-align: center;
  background-color: #fff;
  border: none;
  width: 300px;
  height: 20px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  font-family: 方正舒体;
  margin-top: 15px;
}

.img {
  position: relative;
  top: 25px;
  left: 582px;
  width: 300px;
  height: 300px;
}

.font {
  position: relative;
  top: 220px;
  left: 230px;
}

.manImg {
  position: relative;
  top: 550px;
  left: 350px;
}
</style>